#ifndef MAIN_H_INCLUDED
#define MAIN_H_INCLUDED

//#include "commons.h"

#include <string>
#include <iostream>

#include <SDL/SDL.h>
#include <SDL/SDL_opengl.h>

using namespace std;

bool processExitEvents()
{

    SDL_Event event;
    unsigned int m_Keys[SDLK_LAST];

    while (SDL_PollEvent(&event))//get all events
    {
        switch (event.type)
        {
            // Quit event
            case SDL_QUIT:
            {
                // Return false because we are quitting.
                return false;
            }

            case SDL_KEYDOWN:
            {
                SDLKey sym = event.key.keysym.sym;

                if(sym == SDLK_ESCAPE) //Quit if escape was pressed
                {
                    return false;
                }

                m_Keys[sym] = 1;
                break;
            }

            case SDL_KEYUP:
            {
                SDLKey sym = event.key.keysym.sym;
                m_Keys[sym] = 0;
                break;
            }

            // Default case
            default:
            {
                break;
            }
        }
    }

    return true;
}


#endif // MAIN_H_INCLUDED
